# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-niapy
_pkgorig=NiaPy
pkgver=2.1.0
pkgrel=0
pkgdesc="Python micro framework for building nature-inspired algorithms"
url="https://niapy.org"
arch="noarch"
license="MIT"
depends="python3 py3-numpy py3-pandas py3-openpyxl py3-matplotlib"
checkdepends="py3-pytest-xdist"
makedepends="py3-gpep517 py3-poetry-core"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/NiaOrg/NiaPy/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgorig-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 CITATION.cff -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 Algorithms.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 Problems.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
d877a0b70ce7bf6208593d08f3f7bd4819a663e3fd3dcae57473ceef1505cf1a881ee82a7e92ebc153d8044df959800110c9915641668c90ebd9bee30fef591e  py3-niapy-2.1.0.tar.gz
"
